﻿CREATE PROCEDURE [dbo].[proc_CallCenter_Update]
	(
		@CompanyId int,
		@DepartmentId int,
		@ZXNum int,
		@FJNum int,
		@UserName nvarchar(50),
		@EName nvarchar(50),
		@GId uniqueidentifier
	)
AS
Begin
	Declare @nCount int
	Select @nCount=Count(0) From CallCenter Where CompanyId=@CompanyId And GId<>@GId And (FJNum=@FJNum Or ZXNum=@ZXNum)

	If @nCount = 0
		Update CallCenter Set
			CompanyId=@Companyid,
			DepartmentId=@DepartmentId,
			ZXNum=@ZXNum,
			FJNum=@FJNum,
			UserName=@UserName,
			EName=@EName
		Where GId=@GId
End